/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意：
* 本软件为www.yixiang.co开发研制，未经购买不得使用
* 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
* 一经发现盗用、分享等行为，将追究法律责任，后果自负
*/
package co.yixiang.mall.biz.freeze.mapper;


import co.yixiang.common.mproot.common.mapper.CoreMapper;
import co.yixiang.mall.common.order.domain.TbUserRebateFreeze;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
* @author zhuhongjian
* @date 2021-03-19
*/
@Repository
public interface TbUserRebateFreezeMapper extends CoreMapper<TbUserRebateFreeze> {

    @Update("UPDATE yx_store_order o\n" +
            "LEFT JOIN tb_user_rebate_freeze f ON f.order_id = o.order_id \n" +
            "SET o.freeze = 1,\n" +
            "f.end_time = SYSDATE() \n" +
            "WHERE\n" +
            "\tdate_add( f.start_time, INTERVAL '7 00:00:00' DAY_SECOND ) < SYSDATE() \n" +
            "\tAND o.freeze = 0 ")
    void unfreezeMoney();
}
